package com.teen9g.infoplatformserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teen9g.PageQueryDTO.FansAndFollowsPageQueryDTO;
import com.teen9g.entity.FansAndFollows;
import com.teen9g.vo.FansVO;
import com.teen9g.vo.FollowsVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FollowMapper extends BaseMapper<FansAndFollows> {

    @Select("select count(0) from fans_and_follows where fans_id = #{fansId} and follows_id = #{followsId}")
    int selectByFansIdAndFollowsId(@Param("fansId") Integer fansId, @Param("followsId") Integer followsId);

    @Delete("delete from fans_and_follows where fans_id = #{fansId} and follows_id = #{followsId}")
    int deleteByFansIdAndFollowsId(@Param("fansId") Integer fansId, @Param("followsId") Integer followsId);

    List<FollowsVO> selectFollowsByPage(FansAndFollowsPageQueryDTO queryDTO);

    List<FansVO> selectFansByPage(FansAndFollowsPageQueryDTO queryDTO);
}
